rustc_codegen_ssa: Refactor ArchiveEntry to include entry kind#157263
Open
petrochenkov wants to merge 1 commit into
Open
rustc_codegen_ssa: Refactor ArchiveEntry to include entry kind#157263petrochenkov wants to merge 1 commit into
ArchiveEntry to include entry kind#157263petrochenkov wants to merge 1 commit into
Conversation
petrochenkov
commented
Jun 1, 2026
| .map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?; | ||
| let metadata_link = | ||
| skip.as_ref().and_then(|_| rmeta_link::read(&archive, &archive_map, &archive_path)); | ||
| let metadata_link = rmeta_link::read(&archive, &archive_map, &archive_path); |
Contributor
Author
There was a problem hiding this comment.
We always try to read the link-metadata now.
Right now skip happens to be always Some for Rust rlibs and always None for native libs, so the previous optimization happened to be correct.
We could potentially reinstate the optimization and add a comment saying that skip must always be Some for Rust rlibs, but it's probably not that useful for performance in practice.
petrochenkov
commented
Jun 1, 2026
| } | ||
|
|
||
| // Skip objects for bundled libs. | ||
| if bundled_libs.contains(&Symbol::intern(fname)) { |
Contributor
Author
There was a problem hiding this comment.
From this function we can see that it would be also useful to track at least ArchiveEntryKind::Rmeta and ArchiveEntryKind::BundledNativeLib.
But in general, it would probably make sense to get rid of ArchiveEntryKind::Other and keep the full "entry name -> entry kind" table in the link-metadata.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needed for #155338 in particular.
r? @bjorn3